Skip to content

feat(web): authenticatoor feature grants for test definitions and pprof - #249

Draft
qu0b wants to merge 2 commits into
masterfrom
qu0b/authenticatoor-features
Draft

qu0b wants to merge 2 commits into
masterfrom
qu0b/authenticatoor-features

Conversation

@qu0b

@qu0b qu0b commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Why

With service-authenticatoor#17, a devnet's authenticatoor can issue grants per login, so access can be wider than "everyone behind Cloudflare Access" (ansible-collection-general#598 wires this up for devnets). assertoor already checks the service itself (services claim must allow assertoor). It cannot yet tell basic use apart from the operations that should stay with operators: test definitions can run shell tasks, so registering one is code execution on the assertoor pod.

What

Basic access becomes read-only. Three features, granted per login as assertoor:<feature> (or assertoor:all), each needing an explicit grant (the library's default-deny mode):

Feature Gates
write POST /api/v1/test_runs/schedule (and legacy POST /api/v1/test_run), POST /api/v1/test_runs/delete, POST /api/v1/test_run/{runId}/cancel, PUT /api/v1/dashboard_config, POST /api/v1/ai/chat
test_registry POST /api/v1/tests/register, POST /api/v1/tests/register_external, POST /api/v1/tests/delete, PUT /api/v1/test/{testId}/schedule
pprof /debug/pprof/*

Everything else (tests, runs, results, logs, task details, AI sessions and usage) needs basic assertoor access only. This lets a devnet give every panda user read access with a bare assertoor grant while writes stay with staff.

A login without the feature gets 403 with forbidden: this login lacks the assertoor feature <name>. Swagger docs regenerated (401/403 on the gated endpoints).

Example grant (authenticatoor grants):

- name: client-teams
  members: ["authentik/team:geth"]
  services: [assertoor]                      # read-only
- name: staff
  members: ["authentik/groups:ethpandaops:Core"]
  services: ["all:all"]                      # includes assertoor:test_registry and assertoor:pprof

Compatibility

  • A token without a services claim keeps every feature. An authenticatoor without a grants section mints no claim, and one with grants never mints an empty one, so devnets that have not enabled grants behave exactly as before.
  • Open mode (no authProviderUrl) stays fully open.
  • service-authenticatoor is bumped from v0.0.2 to main at b69364b (the Add task that requests funds from the shadowfork vault #17 merge) for Claims.HasFeature. This should become v0.0.4 once that is tagged; marking the PR draft until then.

Not in this PR

  • The web UI does not hide the gated controls yet; the API is the enforcement. The client script's hasFeature could drive that later.
  • POST /api/v1/ai/validate has no auth today and only validates YAML; left as is.

Testing

  • pkg/web/auth: tokens signed by a real authenticatoor issuer (pkg/issuer) and checked through the real verifier: no claim, +all,+all:all, -all,+assertoor, -all,+assertoor,+assertoor:write, -all,+assertoor,+assertoor:test_registry, assertoor:all, assertoor:all:-pprof, -all,+faucet,+faucet:drop_100eth (refused by the service gate), -all, and open mode. Switching the check to default-allow makes three cases fail, so the table tests the mode. Each case also checks FeatureStatus (200/401/403) for a write request; open mode and a nil handler answer 200.
  • pkg/web: pprof returns 403 for a login without the feature (header and browser cookie), existing cases unchanged.
  • go build ./..., go vet, go test ./... -race on pkg/web/..., full go test ./... pass. golangci-lint run --new-from-rev origin/master ./... (2.14) reports 0 issues.

Registering, deleting and rescheduling tests (test_registry) and pprof
(pprof) now need an explicit assertoor:<feature> grant in the token's
services claim. Tokens without the claim, minted by an authenticatoor
without grants, keep every feature. Bumps service-authenticatoor to
main (b69364b, #17) for the feature evaluation.

@redpandabot redpandabot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds per-login feature grants for test-definition endpoints and pprof, with a compatibility fallback for tokens lacking a services claim, tests using real issuer/verifier flows, regenerated Swagger docs, and a service-authenticatoor bump. I traced the gated handlers, the feature decision in the new library version, and the pprof path; I found no functional or security defect in the change.


Reviewed 17 changed file(s) @ 0c8199a4 — no blocking issues found.
"Good enough is good enough."

Scheduling, cancelling and deleting test runs, editing the dashboard config
and starting AI chats now need assertoor:write. Lets a devnet grant every
panda user read access (assertoor) while writes stay with staff
(assertoor:all / all:all). Tokens without a services claim are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant